//
//  MyHeroView.m
//  WhoElse
//
//  Created by 孙宇鹏 on 15/11/18.
//  Copyright © 2015年 sunsystem. All rights reserved.
//

#import "MyHeroView.h"

@implementation MyHeroView

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        [self updateGUI];
    }
    return self;
}

-(void)updateGUI{
    
    self.backgroundColor = [UIColor whiteColor];
    
    //
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kWidth, 80)];
    view.backgroundColor = [UIColor whiteColor];
    [self addSubview:view];
    
    //
    self.serverName = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, WIDTH(view) - 10, (HEIGHT(view) - 30) /2)];
    self.serverName.text = @"我的英雄(未绑定)";
    [view addSubview:self.serverName];
    
    self.cancelBT = [UIButton buttonWithType:UIButtonTypeSystem];
    self.cancelBT.frame = CGRectMake(kWidth - 80, 10, 80, HEIGHT(self.serverName));
    [self.cancelBT setTitle:@"取消绑定" forState:UIControlStateNormal];
    [view addSubview:self.cancelBT];
    
    self.heroAndGold = [[UILabel alloc]initWithFrame:CGRectMake(10, MaxY(self.serverName) + 10, WIDTH(view) - 10, (HEIGHT(view) - 30) /2)];
    self.heroAndGold.text = @"您总共有0个英雄,价值0金币";
    [view addSubview:self.heroAndGold];
    
    self.loginBT = [UIButton buttonWithType:UIButtonTypeSystem];
    self.loginBT.frame = CGRectMake((kWidth - 100) / 2, (kHeight - MaxY(view) - 50) / 2, 100, 50);
    self.loginBT.titleLabel.font = [UIFont systemFontOfSize:20];
    [self.loginBT setTitle:@"立即设置" forState:UIControlStateNormal];
    [self addSubview:self.loginBT];
    
    //
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, MaxY(view) + 10, kWidth, (HEIGHT(self) - MaxY(view) - 10)) style:UITableViewStylePlain];
    [self addSubview:self.tableView];

    
}

@end
